package com.example.demo.mapper;

import com.example.demo.entity.AnIndexImg;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 首页轮播图的表 Mapper 接口
 * </p>
 *
 * @author Mr.we
 * @since 2024-06-03
 */
@Mapper
public interface AnIndexImgMapper extends BaseMapper<AnIndexImg> {
    /**
     * 根据id列表删除图片
     * @param ids
     */
    @Delete("delete from an_index_img where img_id in" + "#{id}")
    void deleteIndexImgByIds(@Param("ids") Long[] ids);

    /**
     * 获取图片列表
     * @return
     */
    @Select("SELECT *\n" +
            "        FROM an_index_img\n" +
            "        where `status` = 1\n" +
            "        ORDER BY seq DESC")
    List<AnIndexImg> listIndexImg();
}
